<%-- 
    Document   : index
    Created on : 5-mag-2011, 13.24.45
    Author     : alexcarpentieri
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="ejb.Cliente"%>
<%Cliente user = (Cliente) session.getAttribute("cliente");%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>SPC</title>
    </head>
    <body>
        <h1>Super Point Card</h1>
        <h2>Home Page</h2>

        <div>
            <a href="ServletMain">[test] Richiama la servlet (ok se torni qui)</a>
        </div>

        <div>
            <%if (user != null) {%>
            Sei loggato come: <%= user.getUserName()%>
            <%} else {%>
            <h3>Login</h3>
            <form action="ServletMain" method="POST" name="dati">
                <input type="hidden" name="op" value="login"/>
                <table>
                    <tr><td>User:</td><td><input name="username" type="text"/></td></tr>
                    <tr><td>Password:</td><td><input name="password" type="password"/></td></tr>
                    <tr><td>&nbsp;</td><td><input type="submit" value="LOGIN"/></td></tr>
                </table>
            </form>


            <%}%>
            <form action="ServletMain" method="POST" name="dati">
                <input type="hidden" name="op" value="register"/>
                <table>
                    <tr><td>User:</td><td><input name="username" type="text"/></td></tr>
                    <tr><td>Password:</td><td><input name="password" type="password"/></td></tr>
                    <tr><td>Nome:</td><td><input name="nome" type="text"/></td></tr>
                    <tr><td>Cognome:</td><td><input name="cognome" type="text"/></td></tr>
                    <tr><td>Sesso:</td><td><input name="sesso" type="text" size="1"/></td></tr>
                    <tr><td>&nbsp;</td><td><input type="submit" value="REGISTER"/></td></tr>
                </table>
            </form>
            <h3>Crea Esercizio Commerciale</h3>
            <form action="ServletMain" method="POST" name="dati">
                <input type="hidden" name="op" value="registerEsercizioCommerciale"/>
                <table>
                    <tr><td>User:</td><td><input name="username" type="text"/></td></tr>
                    <tr><td>Password:</td><td><input name="password" type="password"/></td></tr>
                    <tr><td>Email:</td><td><input name="email" type="text"/></td></tr>
                    <tr><td>Numero di Telefono:</td><td><input name="telefono" type="text"/></td></tr>
                    <tr><td>Indirizzo:</td><td><input name="indirizzo" type="text"/></td></tr>

                    <tr><td>&nbsp;</td><td><input type="submit" value="REGISTER"/></td></tr>
                </table>
            </form>

            <h3>Visualizza Esercizio Commerciale</h3>
            <form action="ServletMain" method="POST" name="dati">
                <input type="hidden" name="op" value="visualizzaEsercizioCommerciale"/>
                <table>
                    <tr><td>User:</td><td><input name="username" type="text"/></td></tr>
                    <tr><td>Password:</td><td><input name="password" type="password"/></td></tr>

                    <tr><td>&nbsp;</td><td><input type="submit" value="LOGIN"/></td></tr>
                </table>
            </form>

            <h3>Aggiungi Raccolta Punti</h3>
            <form action="ServletMain" method="POST" name="dati">
                <input type="hidden" name="op" value="aggiungiRaccoltaPunti"/>
                <table>
                    <tr><td>User:</td><td><input name="username" type="text"/></td></tr>
                    <tr><td>Password:</td><td><input name="password" type="password"/></td></tr>
                    <tr><td>data inizio:</td><td><input name="dataInizio" type="text"/></td></tr>
                    <tr><td>data fine:</td><td><input name="dataFine" type="text"/></td></tr>

                    <tr><td>&nbsp;</td><td><input type="submit" value="NUOVA CAMPAGNA"/></td></tr>
                </table>
            </form>

            <h3>Iscrizione a Raccolta Punti</h3>
            <form action="ServletMain" method="POST" name="dati">
                <input type="hidden" name="op" value="iscrizioneRaccoltaPunti"/>
                <table>
                    <tr><td>codice a barre:</td><td><input name="codiceBarre" type="text"/></td></tr>
                    <tr><td>esercizio commerciale:</td><td><input name="esercizioCommerciale" type="text"/></td></tr>
                    <tr><td>numero punti:</td><td><input name="numeroPunti" type="text"/></td></tr>

                    <tr><td>&nbsp;</td><td><input type="submit" value="AGGIUNGI"/></td></tr>
                </table>
            </form>

            <h3>Aggiungi Premi alla corrente raccolta premi </h3>
            <form action="ServletMain" method="POST" name="dati">
                <input type="hidden" name="op" value="aggiungiPremi"/>
                <table>
                    <tr><td>esercizio Commerciale:</td><td><input name="user" type="text"/></td></tr>
                    <tr><td>password:</td><td><input name="password" type="text"/></td></tr>
                    <tr><td>numero punti necessari per il premio:</td><td><input name="numeroPunti" type="text"/></td></tr>
                    <tr><td>descrizione:</td><td><input name="descrizione" type="text"/></td></tr>

                    <tr><td>&nbsp;</td><td><input type="submit" value="AGGIUNGI"/></td></tr>
                </table>
            </form>




        </div>
    </body>
</html>
